package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class CopyDemo2 {
    public static void main(String[] args) {
        try (FileInputStream fis = new FileInputStream("ideaIU-2021.1.3.exe");
             FileOutputStream fos = new FileOutputStream("LGHUB2.exe")
        ){
            long s = System.currentTimeMillis();
            byte [] data = new byte[1024*1000];
            int len = fis.read(data);
            System.out.println(len);
            while (len!=-1){
                fos.write(data,0,len);
                len = fis.read(data);
            }
            long b = System.currentTimeMillis();
            System.out.println("复制完毕:耗时"+(b-s)+"ms");
        } catch (Exception e) {}

    }
}
